package com.lenovo.server.utils;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import com.lenovo.server.vote.bean.Option;
import com.lenovo.server.vote.bean.Topic;
import com.lenovo.server.vote.bean.VoteUser;
import static com.lenovo.server.utils.HibDB.sf;
public class TopicUtils {

	
	public static Topic getTopicById(int id){
		Session session = sf.openSession();
		session.beginTransaction();
		Query q = session.createQuery("from Topic t where t.id="+ id);
		List<Topic> lists = (List<Topic>)q.list();
		if(lists == null || lists.size() <= 0){
			return null;
		}
		return lists.get(0);
	}
	
	
}
